﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace PHTShop
{
    public partial class WebForm2 : basePageUser
    {
        private DataContextDataContext dc = new DataContextDataContext();
        protected void Page_Load(object sender, EventArgs e)
        {
              switch (Session["languages"].ToString().ToLower())
            { 
                case "france":
                    Page.Title = "À propos de nous";
                    break;
                case "germany":
                    Page.Title = "Wir über uns";
                    break;
                default:
                    Page.Title = "About us";
                    break;
            }
                this.loadAboutUs();
            
        }

        protected void Page_PreInit(object sender, EventArgs e)
        {
            Setting th = this.dc.Settings.Single(t => t.type.Equals("theme") && Convert.ToInt32(t.value) == 1);
            Page.Theme = th.name.ToString();
        }

        private void loadAboutUs()
        {
            Language lg = this.dc.Languages.Single(t => t.name.Equals(Session["languages"]));
            Content about = this.dc.Contents.Single(t => t.name.Equals("about") && t.idlanguage == lg.id);
            this.LiteralAboutUs.Text = about.details;
        }
    }
}